(function(factory) {
	if (typeof define === "funtcion" && define.amd) {
		define([], factory(this));
	} else {
		var golbal = module ? module.exports : this;
		factory(golbal);
	};
})(function(golbal) {
	var class2type = {},
	core_toString = class2type.toString;
	Array.prototype.forEach = Array.prototype.forEach || function(cbk){
		var that = this;
		for(var i = that.length;i--;){
			cbk.call(that[i],i,that[i]);
		}
	};
	console.log(Array.prototype.forEach);
	"Boolean Number String Function Array Date RegExp Object Error".split(" ").forEach(function(i, name) {
		console.log(i);
		console.log(name);
		class2type[ "[object " + name + "]" ] = name.toLowerCase();
	});
	return {
		type: function(obj) {
			if (obj == null) {
				return String(obj);
			}
			return typeof obj === "object" || typeof obj === "function" ?
				class2type[core_toString.call(obj)] || "object" :
				typeof obj;
		},
		each : function(list,cbk){
			list.forEach(cbk); 
		}
	}
});